package xyz.playedu.inspection.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import xyz.playedu.common.types.paginate.DeviceTypePaginateFiler;
import xyz.playedu.common.types.paginate.PaginationResult;
import xyz.playedu.inspection.domain.DeviceTypeDict;
import xyz.playedu.inspection.mapper.DeviceTypeDictMapper;
import xyz.playedu.inspection.service.DeviceTypeDictService;

@Service
public class DeviceTypeDictServiceImpl extends ServiceImpl<DeviceTypeDictMapper, DeviceTypeDict> implements DeviceTypeDictService {
    @Override
    public PaginationResult<DeviceTypeDict> paginate(int page, int size, DeviceTypePaginateFiler filter) {
        filter.setPageStart((page - 1) * size);
        filter.setPageSize(size);

        PaginationResult<DeviceTypeDict> pageResult = new PaginationResult<>();
        pageResult.setData(getBaseMapper().paginate(filter));
        pageResult.setTotal(getBaseMapper().paginateCount(filter));

        return pageResult;
    }

    @Override
    public DeviceTypeDict getDeviceTypeById(Long id) {
        return getBaseMapper().getDeviceTypeById(id);
    }

    @Override
    public int delInfoById(Long id) {
        return getBaseMapper().delInfoById(id);
    }
}
